Skip to content

fix(mcp): reject unknown tool arguments instead of ignoring them - #3787

Open
Aryainguz wants to merge 2 commits into
ClickHouse:mainfrom
Aryainguz:aryainguz/mcp-strict-tool-inputs
Open

Aryainguz wants to merge 2 commits into
ClickHouse:mainfrom
Aryainguz:aryainguz/mcp-strict-tool-inputs

Conversation

@Aryainguz

Copy link
Copy Markdown
Contributor

Summary

Fixes #3543

MCP tools dropped arguments they didn't know without an error. clickstack_timeseries with having: "count > 5", or a typo like limt: 10, ran without it, so an agent got unfiltered results and couldn't tell. The schemas we send to clients already say additionalProperties: false; the server just didn't enforce it.

createRegisterTool now registers every tool's input schema with .strict(), so an unknown top-level argument returns an error naming it. Top-level keys only, as discussed on the issue.

Before After
Tools that accept an unknown argument 34 of 34 0 of 34
clickstack_timeseries + having runs without it Unrecognized key(s) in object: 'having'
having on clickstack_table (a real option) accepted accepted
tools/list sent to clients unchanged

How to reproduce

Starting point: packages/api, no services needed.

On main:

  1. Add the new test from this PR to src/mcp/__tests__/toolSchemas.test.ts and run yarn ci:unit src/mcp/__tests__/toolSchemas.test.ts.
  2. It fails and lists every tool as accepting notARealOption.

On this branch:

  1. Run the same command. All tests pass.
  2. Calling clickstack_timeseries with having returns Unrecognized key(s) in object: 'having'.

References

@Aryainguz
Aryainguz requested a review from a team as a code owner November 24, 2026 17:15
@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

@Aryainguz is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ed10d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

PR Review

⚠️ The review did not complete: reviewer produced no structured output.

The next push will retry automatically.

@github-actions

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

Copy link
Copy Markdown
Contributor

No description provided.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP builder tools return wrong results without an error: min/max of a DateTime is 0, and unknown options such as having are silently ignored

1 participant